Restore Message
Restores the files associated with a message. Pass an assistant message, or pass a user message to restore the files from its assistant reply. The associated files must not already be the latest files in the chat.
Usage
import { v0 } from 'v0-sdk'const result = await v0.chats.restoreMessage({ chatId: 'chat_abc123', messageId: 'msg_xyz789',})console.log(result)API Signature
Request
Path Parameters
The unique identifier of the chat.
Request Body
The unique identifier of the message whose files to restore.
Response
The user and assistant messages created by the restore, in chronological order.
Unique message identifier.
ID of the chat this message belongs to.
Who produced this message.
ISO timestamp when the message was created.
ISO timestamp when the message was last updated.
The trailing prose of the message — the agent’s closing summary, or the user’s message text. Empty string when there is no closing prose.
Ordered list of parts that make up the message. Iterate to render the full narrative including thinking, file operations, tool calls, and prose.
A block of text output by the agent.
Markdown prose written by the agent or user.
ISO timestamp when this part began.
ISO timestamp when this part completed.
Why generation ended. Null while the agent is still generating; once non-null, the message is final and safe to consume.
Files attached to this message.
URL to the attachment.
Original filename, when available.
MIME type.
Size in bytes.
ID of the user who authored a user message; null for assistant messages.
Token usage and credit cost. All values are zero on user messages and on assistant messages that have not yet generated tokens.
Token counts for this message.
Prompt input value (non-cached).
Completion output value.
Cache-read input value.
Cache-write input value.
Sum of input, output, cacheRead, and cacheWrite.
Credit cost for this message.
Prompt input value (non-cached).
Completion output value.
Cache-read input value.
Cache-write input value.
Sum of input, output, cacheRead, and cacheWrite.
List Chats
Lists chats accessible to the authenticated user. Use metadata[key]=value style query parameters to filter by metadata.
Resume Chat Stream
Resumes consumption of the active assistant generation as Server-Sent Events. If the latest message has already finished, returns a closing chat-state event. The response is `text/event-stream`; each event is `data: <JSON>\n\n` where the JSON conforms to ChatStreamEvent.